package com.zzyl.job;

import com.zzyl.mapper.DeviceDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class deleteJob {

    @Autowired
    private DeviceDataMapper deviceDataMapper;

    /**
     * 定时任务, 定时清理数据，只保留最近一个月（30天）的数据
     */
    @Scheduled(cron="0 0 1 * * ?")
    public void deleteData(){
        deviceDataMapper.deleteData();
    }
}
